#define _CRT_SECURE_NO_WARNINGS 1
#include"Vector.h"

class Solution {
public:
    int maxArea(MySTLVector::vector<int>& height) {
        int ret = 0;
        int left = 0, right = height.size() - 1;
        int v = 0;
        while (left < right)
        {
            v = min(height[left], height[right]) * (right - left);
            ret = max(v, ret);
            if (height[left] < height[right])
            {
                left++;
            }
            else
            {
                right--;
            }
        }
        return ret;
    }
};

int main()
{
    MySTLVector::vector<int> v;
    v.push_back(1);
    v.push_back(8);
    v.push_back(6);
    v.push_back(2);
    v.push_back(5);
    v.push_back(4);
    v.push_back(8);
    v.push_back(5);
    v.push_back(7);

    Solution s;
    int ret = s.maxArea(v);
    cout << ret << endl;
    return 0;
}